package org.dut.transaction.service;

import org.dut.transaction.mapper.LogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

@Service
public class LogService {
    @Autowired
    private LogMapper logMapper;

    @Transactional(propagation = Propagation.NESTED)
    public Integer insertLog(String userName, String op) {
        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
         logMapper.insertLog(userName, op);
         return 1;
    }
}
